package com.sharkburner.aeris.service;

import java.io.Serializable;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;

@Service
public class AuthenticationManager implements Serializable {

    public Authentication getAuthentication() {
	return SecurityContextHolder.getContext().getAuthentication();
    }

    public void logOut() {
	SecurityContextHolder.clearContext();
    }

    public String getUser() {
	Authentication authentication = getAuthentication();
	if (authentication == null)
	    return "";
	return authentication.getName();

    }
}
